<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{$webconfig.web_title|default=''}</title>
    <meta name="keywords" content="{$info.seo_keywords|default=''}">
    <meta name="description" content="{$info.seo_description|default=''}">
    <script>
        addEventListener("load", function () {
            setTimeout(hideURLbar, 0);
        }, false);

        function hideURLbar() {
            window.scrollTo(0, 1);
        }
    </script>
    <!-- Meta tags -->
    <!--stylesheets-->
    <link rel="stylesheet" href="__STATIC__/module/login/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="__STATIC__/module/login1/css/style.css">
    <!--//style sheet end here-->

    <script>
        if (window.top !== window.self) {
            window.top.location = window.location;
        }</script>
</head>

<body class="gray-bg">
<div class="mid-class">
    <div class="art-right-w3ls">
        <h2>科科记账系统后台管理中心</h2>
        <form action="{:url('Login/login')}" method="post" class="login-form">
            <div class="main">
                <div class="form-left-to-w3l">
                    <input type="text" name="username" placeholder="{:lang('账号')}" required="">
                </div>
                <div class="form-left-to-w3l ">
                    <input type="password" name="password" placeholder="{:lang('密码')}" required="">
                    <div class="clear"></div>
                </div>
            </div>
            <div class="form-group">
                <div class="row form-left-to-w3l">
                    <div class="col-sm-6 col-xs-12">
                        <input type="text" name="verify" class=" verify"
                               placeholder="{:lang('输入您的验证码')}">
                    </div>
                    <div class="col-sm-6 col-xs-12">
                        <img src="{:captcha_src()}" alt="captcha"
                             class="admin-login-captcha-img captcha_change" id="captcha_img"/>
                    </div>
                </div>
            </div>
            <div class="clear"></div>
            <div class="btnn">
                <button type="button" class="login-btn">{:lang('登录')}</button>
            </div>
        </form>
        <div class="w3layouts_more-buttn">
            <h3>科科记账系统后台管理中心</h3>
        </div>
    </div>
    <div class="art-left-w3ls">
        <h1 class="header-w3ls">
            科科记账系统 {$info.login_title|default=''} {$info.login_desc|default=''}
        </h1>
        <div class="description">
            <h3>一个功能完善的个人记账应用，支持多平台使用，帮助用户轻松管理个人财务</h3>
        </div>
    </div>
</div>

<!-- Javascript -->
<script src="__STATIC__/module/login/js/jquery-1.11.1.min.js"></script>
<script src="__STATIC__/module/login/bootstrap/js/bootstrap.min.js"></script>
<script src="__STATIC__/module/login/js/jquery.backstretch.min.js"></script>
<!-- layer javascript -->
<script src="__STATIC__/module/admin/js/plugins/layer/layer.min.js"></script>

<!--[if lt IE 10]>
<script src="__STATIC__/module/login/js/placeholder.js"></script>
<![endif]-->
<script>
    $(document).ready(function () {
        $("body").keydown(function (e) {
            var e = event || window.event;
            if (e.keyCode == 13) {
                ajaxlogin();
            }
        });
        $.backstretch("__STATIC__/module/login/img/backgrounds/1.jpg");
    });
    //点击验证码
    $(".captcha_change").click(function () {
        reloadcode();
    });
    //绑定登录
    $("body").on("click", ".login-btn", function () {
        ajaxlogin();
    });

    function ajaxlogin() {
        form = $('.login-form');
        target = form.get(0).action;
        FormData = $("form").serialize();
        $.ajax({
            type: "POST",
            url: target,
            data: FormData,
            dataType: "json",
            success: function (data) {
                reloadcode();
                if (data.code == '1') {
                    layer.msg(data.msg, {icon: 1,shade:0.01});
                    window.location.href = data.url;
                } else {
                    layer.msg(data.msg, {icon: 5});
                }
            }
        });
    }

    //刷新验证码
    function reloadcode() {
        var captcha_img_obj = $("#captcha_img");
        captcha_img_obj.attr("src", captcha_img_obj.attr("src") + "?" + Math.random());
    }

</script>
</body>
</html>
